/**
 * 
 */
package design_pattern.visitor.pc;

/**
 * @author linzq
 *
 */
public class PriceVisitor extends Visitor {

  private float total;

  public PriceVisitor() {
    this.total = 0f;
  }

  public float value() {
    return this.total;
  }

  @Override
  public void visitHardDisk(HardDisk e) {
    total += e.price();
  }

  /*
   * (non-Javadoc)
   * 
   * @see visitor.pc.Visitor#visitPC(visitor.pc.Visitor)
   */
  @Override
  public void visitPC(PC e) {
    total += e.price();
  }

  /*
   * (non-Javadoc)
   * 
   * @see visitor.pc.Visitor#visitMainBoard(visitor.pc.Visitor)
   */
  @Override
  public void visitMainBoard(MainBoard e) {
    total += e.price();
  }

  /*
   * (non-Javadoc)
   * 
   * @see visitor.pc.Visitor#visitCase(visitor.pc.Visitor)
   */
  @Override
  public void visitCase(Case e) {
    total += e.price();
  }

  /*
   * (non-Javadoc)
   * 
   * @see visitor.pc.Visitor#visitCPU(visitor.pc.Visitor)
   */
  @Override
  public void visitCPU(CPU e) {
    total += e.price();
  }

  /*
   * (non-Javadoc)
   * 
   * @see visitor.pc.Visitor#visitIntegratedBoard(visitor.pc.Visitor)
   */
  @Override
  public void visitIntegratedBoard(IntegratedBoard e) {
    total += e.price();
  }

}
